package cn.hongsw.taskschedule.controller;

import cn.hongsw.taskschedule.mapper.UserMapper;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author :hongsw
 * @date :2021-05-19 11:40
 */
@RestController
public class TestController {

    @Resource
    private UserMapper mapper;

    @GetMapping("test")
    public String test(String ds) {
        DynamicDataSourceContextHolder.push(ds);
        mapper.get().forEach(System.out::println);
        return "yes";
    }


}
